/**
 * GameScene.m
 * 
 * 
 * Revision History: 
 *  
 * Date     Author       Version   Changes
 * ======== ============ ========= ================================================================
 * 05/08/09 PJ Cabrera   1.0       Initial version. 
 * 
 * ======== ============ ========= ================================================================
 *
 */

#import "GameScene.h"
#import "GameEngineLayer.h"

@implementation GameScene

/* This method initializes a Sprite object, which loads the background image. Then it sets the 
   Sprite's on-screen location to the middle of the screen. Finally, it adds the background sprite 
   to the scene and then proceed to instantiate the GameLogicLayer class and add it to the scene.  */
- (id) init 
{
    self = [super init];
    
	if (self != nil) 
	{
		Sprite *bg = [Sprite spriteWithFile:@"background.png"];
		[bg setPosition:ccp (160, 240) ];
		[self addChild:bg z:0];
		
		/* Set the depth ordering to 1, so everything will be on top of this background layer  */
        Layer *layer = [GameEngineLayer node];
		[self addChild:layer z:1];
    }
    return self;
}


/* This method removes all objects added to the scene, indicating you want Cocos2D to “clean up” by 
   releasing the objects as well, and then you must call the dealloc method of the superclass  */
- (void) dealloc 
{
	NSLog(@"Entered GameScene dealloc");
	[self removeAllChildrenWithCleanup:YES];
	[super dealloc];
	NSLog(@"Leaving GameScene dealloc");
}

@end
